﻿namespace StringsAndTextProcessing
{
    using System;

    class CorrectBracketsCheck
    {
        // 1.2.13.03. Write a program to check if in a given expression the brackets are put correctly.
        // Example of correct expression: ((a+b)/5-d).
        // Example of incorrect expression: )(a+b)).

        static void Main()
        {
            var text = Console.ReadLine();
            var openBrackets = 0;

            for (var i = 0; i < text.Length && openBrackets >= 0; i++)
            {
                if (text[i] == '(')
                {
                    openBrackets++;
                }
                else if (text[i] == ')')
                {
                    openBrackets--;
                }
            }

            Console.WriteLine(openBrackets == 0);
        }
    }
}